/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package r2x;

import java.sql.*;
/**
 *
 * @author przemek
 */
public class DBConnector {



DBConnector()
{

}


public Connection connectToDB (String userName, String password, String url)
{
    Connection conn = null;
    try
           {
               Class.forName ("com.mysql.jdbc.Driver").newInstance ();
               conn = DriverManager.getConnection (url, userName, password);
           }
           catch (Exception e)
           {
               e.printStackTrace();
           }
    return conn;
}

public Connection disconnectFromDB (Connection conn){
                   try
                   {
                       conn.close ();
                   }
                   catch (Exception e) { /* ignore close errors */ }
                   finally {
                   return null; }
}


}
